import java.awt.*;

public class Bullet {
    private static final int WIDTH = 4;
    private static final int HEIGHT = 15;
    private static final int SPEED = 10;

    private int x, y;

    public Bullet(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public void update() {
        y -= SPEED;
    }

    public void draw(Graphics2D g2d) {
        // 绘制子弹
        g2d.setColor(Color.YELLOW);
        g2d.fillRect(x, y, WIDTH, HEIGHT);

        // 绘制子弹尾焰
        g2d.setColor(Color.ORANGE);
        g2d.fillRect(x, y + HEIGHT, WIDTH, HEIGHT / 2);
    }

    public Rectangle getBounds() {
        return new Rectangle(x, y, WIDTH, HEIGHT);
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }
}    